3.102 \(\int \frac{1}{1+x^2+2 x \cos (\frac{\pi }{7})} \, dx\)

Optimal. Leaf size=23 \[ \csc \left (\frac{\pi }{7}\right ) \tan ^{-1}\left (x \csc \left (\frac{\pi }{7}\right )+\cot \left (\frac{\pi }{7}\right )\right ) \]

[Out]

ArcTan[Cot[Pi/7] + x*Csc[Pi/7]]*Csc[Pi/7]

________________________________________________________________________________________

Rubi [A]  time = 0.0277957, antiderivative size = 23, normalized size of antiderivative = 1., number of steps used = 2, number of rules used = 2, integrand size = 16, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.125, Rules used = {618, 204} \[ \csc \left (\frac{\pi }{7}\right ) \tan ^{-1}\left (\csc \left (\frac{\pi }{7}\right ) \left (x+\cos \left (\frac{\pi }{7}\right )\right )\right ) \]

Antiderivative was successfully verified.

[In]

Int[(1 + x^2 + 2*x*Cos[Pi/7])^(-1),x]

[Out]

ArcTan[(x + Cos[Pi/7])*Csc[Pi/7]]*Csc[Pi/7]

Rule 618

Int[((a_.) + (b_.)*(x_) + (c_.)*(x_)^2)^(-1), x_Symbol] :> Dist[-2, Subst[Int[1/Simp[b^2 - 4*a*c - x^2, x], x]
, x, b + 2*c*x], x] /; FreeQ[{a, b, c}, x] && NeQ[b^2 - 4*a*c, 0]

Rule 204

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> -Simp[ArcTan[(Rt[-b, 2]*x)/Rt[-a, 2]]/(Rt[-a, 2]*Rt[-b, 2]), x] /
; FreeQ[{a, b}, x] && PosQ[a/b] && (LtQ[a, 0] || LtQ[b, 0])

Rubi steps

\begin{align*} \int \frac{1}{1+x^2+2 x \cos \left (\frac{\pi }{7}\right )} \, dx &=-\left (2 \operatorname{Subst}\left (\int \frac{1}{-x^2-4 \sin ^2\left (\frac{\pi }{7}\right )} \, dx,x,2 x+2 \cos \left (\frac{\pi }{7}\right )\right )\right )\\ &=\tan ^{-1}\left (\left (x+\cos \left (\frac{\pi }{7}\right )\right ) \csc \left (\frac{\pi }{7}\right )\right ) \csc \left (\frac{\pi }{7}\right )\\ \end{align*}

Mathematica [B]  time = 0.0397657, size = 56, normalized size = 2.43 \[ \frac{2 \tan ^{-1}\left (\frac{2 x-(-1)^{6/7}+\sqrt [7]{-1}}{\sqrt{2-(-1)^{2/7}+(-1)^{5/7}}}\right )}{\sqrt{2-(-1)^{2/7}+(-1)^{5/7}}} \]

Warning: Unable to verify antiderivative.

[In]

Integrate[(1 + x^2 + 2*x*Cos[Pi/7])^(-1),x]

[Out]

(2*ArcTan[((-1)^(1/7) - (-1)^(6/7) + 2*x)/Sqrt[2 - (-1)^(2/7) + (-1)^(5/7)]])/Sqrt[2 - (-1)^(2/7) + (-1)^(5/7)
]

________________________________________________________________________________________

Maple [B]  time = 0.091, size = 39, normalized size = 1.7 \begin{align*}{\frac{1}{\sqrt{1- \left ( \cos \left ({\frac{\pi }{7}} \right ) \right ) ^{2}}}\arctan \left ({\frac{2\,x+2\,\cos \left ( \pi /7 \right ) }{2\,\sqrt{1- \left ( \cos \left ( \pi /7 \right ) \right ) ^{2}}}} \right ) } \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(1/(1+x^2+2*x*cos(1/7*Pi)),x)

[Out]

1/(1-cos(1/7*Pi)^2)^(1/2)*arctan(1/2*(2*x+2*cos(1/7*Pi))/(1-cos(1/7*Pi)^2)^(1/2))

________________________________________________________________________________________

Maxima [A]  time = 1.71017, size = 45, normalized size = 1.96 \begin{align*} \frac{\arctan \left (\frac{x + \cos \left (\frac{1}{7} \, \pi \right )}{\sqrt{-\cos \left (\frac{1}{7} \, \pi \right )^{2} + 1}}\right )}{\sqrt{-\cos \left (\frac{1}{7} \, \pi \right )^{2} + 1}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(1/(1+x^2+2*x*cos(1/7*pi)),x, algorithm="maxima")

[Out]

arctan((x + cos(1/7*pi))/sqrt(-cos(1/7*pi)^2 + 1))/sqrt(-cos(1/7*pi)^2 + 1)

________________________________________________________________________________________

Fricas [A]  time = 2.46555, size = 69, normalized size = 3. \begin{align*} \frac{\arctan \left (\frac{x + \cos \left (\frac{1}{7} \, \pi \right )}{\sin \left (\frac{1}{7} \, \pi \right )}\right )}{\sin \left (\frac{1}{7} \, \pi \right )} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(1/(1+x^2+2*x*cos(1/7*pi)),x, algorithm="fricas")

[Out]

arctan((x + cos(1/7*pi))/sin(1/7*pi))/sin(1/7*pi)

________________________________________________________________________________________

Sympy [C]  time = 0.732172, size = 70, normalized size = 3.04 \begin{align*} - \frac{i \log{\left (x + \cos{\left (\frac{\pi }{7} \right )} - \frac{i \left (2 - 2 \cos ^{2}{\left (\frac{\pi }{7} \right )}\right )}{2 \sin{\left (\frac{\pi }{7} \right )}} \right )}}{2 \sin{\left (\frac{\pi }{7} \right )}} + \frac{i \log{\left (x + \cos{\left (\frac{\pi }{7} \right )} + \frac{i \left (2 - 2 \cos ^{2}{\left (\frac{\pi }{7} \right )}\right )}{2 \sin{\left (\frac{\pi }{7} \right )}} \right )}}{2 \sin{\left (\frac{\pi }{7} \right )}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(1/(1+x**2+2*x*cos(1/7*pi)),x)

[Out]

-I*log(x + cos(pi/7) - I*(2 - 2*cos(pi/7)**2)/(2*sin(pi/7)))/(2*sin(pi/7)) + I*log(x + cos(pi/7) + I*(2 - 2*co
s(pi/7)**2)/(2*sin(pi/7)))/(2*sin(pi/7))

________________________________________________________________________________________

Giac [A]  time = 1.21056, size = 45, normalized size = 1.96 \begin{align*} \frac{\arctan \left (\frac{x + \cos \left (\frac{1}{7} \, \pi \right )}{\sqrt{-\cos \left (\frac{1}{7} \, \pi \right )^{2} + 1}}\right )}{\sqrt{-\cos \left (\frac{1}{7} \, \pi \right )^{2} + 1}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(1/(1+x^2+2*x*cos(1/7*pi)),x, algorithm="giac")

[Out]

arctan((x + cos(1/7*pi))/sqrt(-cos(1/7*pi)^2 + 1))/sqrt(-cos(1/7*pi)^2 + 1)